package com.mk.eventbus;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        textView = (TextView) findViewById(R.id.text);
        EventBus.getInstance().regist(this);
    }


    public void startAno(View view) {
        startActivity(new Intent(this, Main2Activity.class));
    }

    public void imChatEventMain(TestMsg testMsg) {
        System.out.println("收到消息");
        textView.setText(testMsg.con);
    }

    @Override
    protected void onDestroy() {

        EventBus.getInstance().unregist(this);
        super.onDestroy();
    }
}
